﻿using System;
using System.Collections.Generic;
using System.Linq;
using Helpers;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.CampaignSystem.ComponentInterfaces;
using TaleWorlds.CampaignSystem.Conversation;
using TaleWorlds.CampaignSystem.Conversation.Persuasion;
using TaleWorlds.CampaignSystem.Encounters;
using TaleWorlds.CampaignSystem.GameMenus;
using TaleWorlds.CampaignSystem.Map;
using TaleWorlds.CampaignSystem.MapEvents;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Party.PartyComponents;
using TaleWorlds.CampaignSystem.Roster;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;

namespace TaleWorlds.CampaignSystem.Issues
{
	// Token: 0x02000311 RID: 785
	public class LesserNobleRevoltIssueBehavior : CampaignBehaviorBase
	{
		// Token: 0x06002D61 RID: 11617 RVA: 0x000BDDD4 File Offset: 0x000BBFD4
		public override void RegisterEvents()
		{
			CampaignEvents.OnCheckForIssueEvent.AddNonSerializedListener(this, new Action<Hero>(this.OnCheckForIssue));
		}

		// Token: 0x06002D62 RID: 11618 RVA: 0x000BDDED File Offset: 0x000BBFED
		public override void SyncData(IDataStore dataStore)
		{
		}

		// Token: 0x06002D63 RID: 11619 RVA: 0x000BDDEF File Offset: 0x000BBFEF
		private bool ConditionsHold(Hero issueGiver)
		{
			return issueGiver.IsLord && !issueGiver.IsFactionLeader && issueGiver.MapFaction.IsKingdomFaction && issueGiver.Clan != null && issueGiver.Clan.Fiefs.Count >= 3;
		}

		// Token: 0x06002D64 RID: 11620 RVA: 0x000BDE30 File Offset: 0x000BC030
		public void OnCheckForIssue(Hero hero)
		{
			if (this.ConditionsHold(hero))
			{
				Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(new PotentialIssueData.StartIssueDelegate(this.OnSelected), typeof(LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssue), IssueBase.IssueFrequency.Rare, null));
				return;
			}
			Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(typeof(LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssue), IssueBase.IssueFrequency.Rare));
		}

		// Token: 0x06002D65 RID: 11621 RVA: 0x000BDE94 File Offset: 0x000BC094
		private IssueBase OnSelected(in PotentialIssueData pid, Hero issueOwner)
		{
			return new LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssue(issueOwner);
		}

		// Token: 0x06002D66 RID: 11622 RVA: 0x000BDE9C File Offset: 0x000BC09C
		private static TextObject GetLesserNobleTitle(Hero questGiver)
		{
			string stringId = questGiver.Culture.StringId;
			if (stringId == "sturgia")
			{
				return new TextObject("{=k1Xr4rKn}Druzhinnik", null);
			}
			if (stringId == "vlandia")
			{
				return new TextObject("{=WtEoXblx}Knight", null);
			}
			if (stringId == "battania")
			{
				return new TextObject("{=8Kx17LDS}Fian", null);
			}
			if (stringId == "empire")
			{
				return new TextObject("{=5qRuGS2P}Equite", null);
			}
			if (stringId == "khuzait")
			{
				return new TextObject("{=ZaIBcQxa}Kheshig", null);
			}
			if (!(stringId == "aserai"))
			{
				return null;
			}
			return new TextObject("{=1UBNuatk}Faris", null);
		}

		// Token: 0x04000D96 RID: 3478
		private const IssueBase.IssueFrequency LesserNobleRevoltIssueIssueFrequency = IssueBase.IssueFrequency.Rare;

		// Token: 0x02000647 RID: 1607
		public class LesserNobleRevoltIssue : IssueBase
		{
			// Token: 0x06004F77 RID: 20343 RVA: 0x0016ACA5 File Offset: 0x00168EA5
			internal static void AutoGeneratedStaticCollectObjectsLesserNobleRevoltIssue(object o, List<object> collectedObjects)
			{
				((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssue)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x06004F78 RID: 20344 RVA: 0x0016ACB3 File Offset: 0x00168EB3
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
				collectedObjects.Add(this._lesserNobleName);
			}

			// Token: 0x06004F79 RID: 20345 RVA: 0x0016ACC8 File Offset: 0x00168EC8
			internal static object AutoGeneratedGetMemberValue_lesserNobleName(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssue)o)._lesserNobleName;
			}

			// Token: 0x1700108F RID: 4239
			// (get) Token: 0x06004F7A RID: 20346 RVA: 0x0016ACD5 File Offset: 0x00168ED5
			public override IssueBase.AlternativeSolutionScaleFlag AlternativeSolutionScaleFlags
			{
				get
				{
					return IssueBase.AlternativeSolutionScaleFlag.Casualties | IssueBase.AlternativeSolutionScaleFlag.FailureRisk;
				}
			}

			// Token: 0x17001090 RID: 4240
			// (get) Token: 0x06004F7B RID: 20347 RVA: 0x0016ACD9 File Offset: 0x00168ED9
			public override int AlternativeSolutionBaseNeededMenCount
			{
				get
				{
					return (int)(26f + 34f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17001091 RID: 4241
			// (get) Token: 0x06004F7C RID: 20348 RVA: 0x0016ACEE File Offset: 0x00168EEE
			protected override int AlternativeSolutionBaseDurationInDaysInternal
			{
				get
				{
					return (int)(7f + 13f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17001092 RID: 4242
			// (get) Token: 0x06004F7D RID: 20349 RVA: 0x0016AD03 File Offset: 0x00168F03
			protected override int RewardGold
			{
				get
				{
					return 150 * base.IssueOwner.RandomIntWithSeed((uint)this.IssueCreationTime.ElapsedDaysUntilNow, 30, 60);
				}
			}

			// Token: 0x17001093 RID: 4243
			// (get) Token: 0x06004F7E RID: 20350 RVA: 0x0016AD26 File Offset: 0x00168F26
			private TextObject LesserNobleTitle
			{
				get
				{
					return LesserNobleRevoltIssueBehavior.GetLesserNobleTitle(base.IssueOwner);
				}
			}

			// Token: 0x17001094 RID: 4244
			// (get) Token: 0x06004F7F RID: 20351 RVA: 0x0016AD33 File Offset: 0x00168F33
			public override TextObject IssueBriefByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=BbqzSmHG}Yes... As you know, the wars this realm has fought have been very costly. The great lords in particular are hard-put to raise the armies that are key to this land's defense. Some of us have proposed increasing the hearth taxes paid by the peasantry, which is a key source of revenue. I don't know if this law will be approved, but rumors of it have gotten out in my district, and a lot of the farmers are restless. Now, most of us are doing their part to keep a lid on things. But there's one, {MALE_LESSER_NOBLE_NAME}, who I am ashamed to say was once a {TOP_TIER_CAV_TITLE} under my banner, who's been going around the countryside, stirring up trouble. He's gathered a following and they have a whole list of demands, including a ban on new taxes, that would frankly cripple our realm's ability to raise the money needed to defend itself. I'd take care of him myself, but that wouldn't look good. Maybe you can help?[if:convo_thinking][ib:closed2]", null);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					textObject.SetTextVariable("TOP_TIER_CAV_TITLE", this.LesserNobleTitle);
					return textObject;
				}
			}

			// Token: 0x17001095 RID: 4245
			// (get) Token: 0x06004F80 RID: 20352 RVA: 0x0016AD64 File Offset: 0x00168F64
			public override TextObject IssueAcceptByPlayer
			{
				get
				{
					return new TextObject("{=8m8wIhZW}Maybe. What do you need exactly?", null);
				}
			}

			// Token: 0x17001096 RID: 4246
			// (get) Token: 0x06004F81 RID: 20353 RVA: 0x0016AD71 File Offset: 0x00168F71
			public override TextObject IssueQuestSolutionExplanationByIssueGiver
			{
				get
				{
					return new TextObject("{=muFvSMrb}His band has been going about from village to village. Find him and stop him. You can tell him he's guilty of sedition, and if he doesn't disperse, then you can use force.[if:convo_thinking][ib:hip2]", null);
				}
			}

			// Token: 0x17001097 RID: 4247
			// (get) Token: 0x06004F82 RID: 20354 RVA: 0x0016AD7E File Offset: 0x00168F7E
			public override TextObject IssuePlayerResponseAfterAlternativeExplanation
			{
				get
				{
					return new TextObject("{=sMCN7eCp}Is there any other way to solve this problem?", null);
				}
			}

			// Token: 0x17001098 RID: 4248
			// (get) Token: 0x06004F83 RID: 20355 RVA: 0x0016AD8B File Offset: 0x00168F8B
			public override TextObject IssueAlternativeSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=bbXFwya1}Not that I can think of. But if you don't want to do it, you can nominate someone from your party. It's not going to be easy, though. Whoever you name should be a good leader and have a good knowledge of tactics, and should take along at least {ALTERNATIVE_SOLUTION_NEEDED_MAN_COUNT} men. I'm ready to pay {REWARD}{GOLD_ICON} for your service. And if it comes to a fight, you can take whatever loot you want as spoils of war.[if:convo_thinking]", null);
					textObject.SetTextVariable("ALTERNATIVE_SOLUTION_NEEDED_MAN_COUNT", base.GetTotalAlternativeSolutionNeededMenCount());
					textObject.SetTextVariable("REWARD", this.RewardGold);
					return textObject;
				}
			}

			// Token: 0x17001099 RID: 4249
			// (get) Token: 0x06004F84 RID: 20356 RVA: 0x0016ADBC File Offset: 0x00168FBC
			public override TextObject IssueQuestSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=a9pK8pyq}I'll find them and put a stop to what they're doing.", null);
				}
			}

			// Token: 0x1700109A RID: 4250
			// (get) Token: 0x06004F85 RID: 20357 RVA: 0x0016ADC9 File Offset: 0x00168FC9
			public override TextObject IssueAlternativeSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=hmaZ6Snq}Don't worry. I will send my best men to deal with this.", null);
				}
			}

			// Token: 0x1700109B RID: 4251
			// (get) Token: 0x06004F86 RID: 20358 RVA: 0x0016ADD6 File Offset: 0x00168FD6
			public override TextObject IssueAlternativeSolutionResponseByIssueGiver
			{
				get
				{
					return new TextObject("{=yLqDHZv9}Thank you.[if:convo_relaxed_happy] I hope your men deal with them as soon as possible.", null);
				}
			}

			// Token: 0x1700109C RID: 4252
			// (get) Token: 0x06004F87 RID: 20359 RVA: 0x0016ADE3 File Offset: 0x00168FE3
			public override bool IsThereAlternativeSolution
			{
				get
				{
					return true;
				}
			}

			// Token: 0x1700109D RID: 4253
			// (get) Token: 0x06004F88 RID: 20360 RVA: 0x0016ADE6 File Offset: 0x00168FE6
			public override bool IsThereLordSolution
			{
				get
				{
					return false;
				}
			}

			// Token: 0x1700109E RID: 4254
			// (get) Token: 0x06004F89 RID: 20361 RVA: 0x0016ADEC File Offset: 0x00168FEC
			protected override TextObject AlternativeSolutionStartLog
			{
				get
				{
					TextObject textObject = new TextObject("{=fhAsNPoE}{ISSUE_GIVER.LINK}, lord of {SETTLEMENT}, says that a {MALE_LESSER_NOBLE_TITLE} named {MALE_LESSER_NOBLE_NAME} is stirring up unrest in the countryside. You asked your companion to deal with {MALE_LESSER_NOBLE_NAME}'s band. They should rejoin your party in {RETURN_DAYS} days", null);
					StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, textObject, false);
					textObject.SetTextVariable("RETURN_DAYS", base.GetTotalAlternativeSolutionDurationInDays());
					textObject.SetTextVariable("MALE_LESSER_NOBLE_TITLE", this.LesserNobleTitle);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x1700109F RID: 4255
			// (get) Token: 0x06004F8A RID: 20362 RVA: 0x0016AE54 File Offset: 0x00169054
			public override TextObject Title
			{
				get
				{
					TextObject textObject = new TextObject("{=xxZeGhqf}{MALE_LESSER_NOBLE_NAME}{.o} Revolt", null);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x170010A0 RID: 4256
			// (get) Token: 0x06004F8B RID: 20363 RVA: 0x0016AE73 File Offset: 0x00169073
			public override TextObject Description
			{
				get
				{
					TextObject textObject = new TextObject("{=bYTSR4AG}{ISSUE_GIVER.LINK} wants you to stop the {MALE_LESSER_NOBLE_NAME}'s movement before it turns into a strong resistance.", null);
					StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, null, false);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x06004F8C RID: 20364 RVA: 0x0016AEAC File Offset: 0x001690AC
			public LesserNobleRevoltIssue(Hero issueOwner) : base(issueOwner, CampaignTime.DaysFromNow(20f))
			{
				MBReadOnlyList<TextObject> nameListForCulture = NameGenerator.Current.GetNameListForCulture(base.IssueOwner.Culture, false);
				this._lesserNobleName = nameListForCulture.GetRandomElement<TextObject>();
			}

			// Token: 0x06004F8D RID: 20365 RVA: 0x0016AEED File Offset: 0x001690ED
			protected override float GetIssueEffectAmountInternal(IssueEffect issueEffect)
			{
				if (issueEffect == DefaultIssueEffects.ClanInfluence)
				{
					return -1f;
				}
				return 0f;
			}

			// Token: 0x06004F8E RID: 20366 RVA: 0x0016AF02 File Offset: 0x00169102
			public override ValueTuple<SkillObject, int> GetAlternativeSolutionSkill(Hero hero)
			{
				return new ValueTuple<SkillObject, int>((hero.GetSkillValue(DefaultSkills.Leadership) >= hero.GetSkillValue(DefaultSkills.Scouting)) ? DefaultSkills.Leadership : DefaultSkills.Scouting, 120);
			}

			// Token: 0x06004F8F RID: 20367 RVA: 0x0016AF2F File Offset: 0x0016912F
			public override bool DoTroopsSatisfyAlternativeSolution(TroopRoster troopRoster, out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(troopRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x06004F90 RID: 20368 RVA: 0x0016AF47 File Offset: 0x00169147
			public override bool IsTroopTypeNeededByAlternativeSolution(CharacterObject character)
			{
				return character.Tier >= 2;
			}

			// Token: 0x06004F91 RID: 20369 RVA: 0x0016AF55 File Offset: 0x00169155
			public override bool AlternativeSolutionCondition(out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(MobileParty.MainParty.MemberRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x06004F92 RID: 20370 RVA: 0x0016AF76 File Offset: 0x00169176
			public override IssueBase.IssueFrequency GetFrequency()
			{
				return IssueBase.IssueFrequency.Rare;
			}

			// Token: 0x06004F93 RID: 20371 RVA: 0x0016AF79 File Offset: 0x00169179
			public override bool IssueStayAliveConditions()
			{
				return base.IssueOwner.Clan.Fiefs.Count >= 2 && base.IssueOwner.MapFaction.IsKingdomFaction;
			}

			// Token: 0x06004F94 RID: 20372 RVA: 0x0016AFA8 File Offset: 0x001691A8
			protected override bool CanPlayerTakeQuestConditions(Hero issueGiver, out IssueBase.PreconditionFlags flag, out Hero relationHero, out SkillObject skill)
			{
				skill = null;
				relationHero = null;
				flag = IssueBase.PreconditionFlags.None;
				if (issueGiver.GetRelationWithPlayer() < -10f)
				{
					flag |= IssueBase.PreconditionFlags.Relation;
					relationHero = issueGiver;
				}
				if (MobileParty.MainParty.MemberRoster.TotalHealthyCount < 50)
				{
					flag |= IssueBase.PreconditionFlags.NotEnoughTroops;
				}
				if (issueGiver.MapFaction.IsAtWarWith(Hero.MainHero.MapFaction))
				{
					flag |= IssueBase.PreconditionFlags.AtWar;
				}
				if (Clan.PlayerClan.Kingdom != issueGiver.MapFaction)
				{
					flag |= IssueBase.PreconditionFlags.NotInSameFaction;
				}
				if (Hero.MainHero.IsKingdomLeader)
				{
					flag |= IssueBase.PreconditionFlags.MainHeroIsKingdomLeader;
				}
				return flag == IssueBase.PreconditionFlags.None;
			}

			// Token: 0x06004F95 RID: 20373 RVA: 0x0016B047 File Offset: 0x00169247
			protected override void OnGameLoad()
			{
			}

			// Token: 0x06004F96 RID: 20374 RVA: 0x0016B049 File Offset: 0x00169249
			protected override void HourlyTick()
			{
			}

			// Token: 0x06004F97 RID: 20375 RVA: 0x0016B04B File Offset: 0x0016924B
			protected override QuestBase GenerateIssueQuest(string questId)
			{
				return new LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest(questId, base.IssueOwner, CampaignTime.DaysFromNow(100f), this.RewardGold, this._lesserNobleName);
			}

			// Token: 0x06004F98 RID: 20376 RVA: 0x0016B06F File Offset: 0x0016926F
			protected override void CompleteIssueWithTimedOutConsequences()
			{
			}

			// Token: 0x170010A1 RID: 4257
			// (get) Token: 0x06004F99 RID: 20377 RVA: 0x0016B071 File Offset: 0x00169271
			protected override int CompanionSkillRewardXP
			{
				get
				{
					return (int)(800f + 1000f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x06004F9A RID: 20378 RVA: 0x0016B086 File Offset: 0x00169286
			protected override void AlternativeSolutionEndWithSuccessConsequence()
			{
				GainRenownAction.Apply(Hero.MainHero, 1f, false);
				TraitLevelingHelper.OnIssueSolvedThroughAlternativeSolution(Hero.MainHero, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, 15)
				});
				this.RelationshipChangeWithIssueOwner = 5;
			}

			// Token: 0x06004F9B RID: 20379 RVA: 0x0016B0BE File Offset: 0x001692BE
			protected override void AlternativeSolutionEndWithFailureConsequence()
			{
				this.RelationshipChangeWithIssueOwner = -5;
				TraitLevelingHelper.OnIssueFailed(Hero.MainHero, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -15)
				});
			}

			// Token: 0x04001A4B RID: 6731
			private const int MinimumRequiredMenCount = 50;

			// Token: 0x04001A4C RID: 6732
			private const int IssueDuration = 20;

			// Token: 0x04001A4D RID: 6733
			private const int QuestTimeLimit = 100;

			// Token: 0x04001A4E RID: 6734
			private const int AlternativeSolutionTroopTierRequirement = 2;

			// Token: 0x04001A4F RID: 6735
			private const int CompanionRequiredSkillLevel = 120;

			// Token: 0x04001A50 RID: 6736
			[SaveableField(20)]
			private TextObject _lesserNobleName;
		}

		// Token: 0x02000648 RID: 1608
		public class LesserNobleRevoltIssueQuest : QuestBase
		{
			// Token: 0x06004F9C RID: 20380 RVA: 0x0016B0E7 File Offset: 0x001692E7
			internal static void AutoGeneratedStaticCollectObjectsLesserNobleRevoltIssueQuest(object o, List<object> collectedObjects)
			{
				((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x06004F9D RID: 20381 RVA: 0x0016B0F8 File Offset: 0x001692F8
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
				collectedObjects.Add(this._lesserNobleName);
				collectedObjects.Add(this._lesserNobleParty);
				collectedObjects.Add(this._suitableVillagesToVisitList);
				collectedObjects.Add(this._visitedVillagesList);
				collectedObjects.Add(this._discreteLog);
			}

			// Token: 0x06004F9E RID: 20382 RVA: 0x0016B148 File Offset: 0x00169348
			internal static object AutoGeneratedGetMemberValue_checkForEventEnd(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._checkForEventEnd;
			}

			// Token: 0x06004F9F RID: 20383 RVA: 0x0016B15A File Offset: 0x0016935A
			internal static object AutoGeneratedGetMemberValue_lesserNobleName(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._lesserNobleName;
			}

			// Token: 0x06004FA0 RID: 20384 RVA: 0x0016B167 File Offset: 0x00169367
			internal static object AutoGeneratedGetMemberValue_lesserNobleParty(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._lesserNobleParty;
			}

			// Token: 0x06004FA1 RID: 20385 RVA: 0x0016B174 File Offset: 0x00169374
			internal static object AutoGeneratedGetMemberValue_suitableVillagesToVisitList(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._suitableVillagesToVisitList;
			}

			// Token: 0x06004FA2 RID: 20386 RVA: 0x0016B181 File Offset: 0x00169381
			internal static object AutoGeneratedGetMemberValue_visitedVillagesList(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._visitedVillagesList;
			}

			// Token: 0x06004FA3 RID: 20387 RVA: 0x0016B18E File Offset: 0x0016938E
			internal static object AutoGeneratedGetMemberValue_persuasionTriedOnce(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._persuasionTriedOnce;
			}

			// Token: 0x06004FA4 RID: 20388 RVA: 0x0016B1A0 File Offset: 0x001693A0
			internal static object AutoGeneratedGetMemberValue_firstTalkIsDone(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._firstTalkIsDone;
			}

			// Token: 0x06004FA5 RID: 20389 RVA: 0x0016B1B2 File Offset: 0x001693B2
			internal static object AutoGeneratedGetMemberValue_goOutFromSettlementAfterHoursCounter(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._goOutFromSettlementAfterHoursCounter;
			}

			// Token: 0x06004FA6 RID: 20390 RVA: 0x0016B1C4 File Offset: 0x001693C4
			internal static object AutoGeneratedGetMemberValue_giveNotificationAfterHoursCounter(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._giveNotificationAfterHoursCounter;
			}

			// Token: 0x06004FA7 RID: 20391 RVA: 0x0016B1D6 File Offset: 0x001693D6
			internal static object AutoGeneratedGetMemberValue_discreteLog(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._discreteLog;
			}

			// Token: 0x06004FA8 RID: 20392 RVA: 0x0016B1E3 File Offset: 0x001693E3
			internal static object AutoGeneratedGetMemberValue_rewardGold(object o)
			{
				return ((LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest)o)._rewardGold;
			}

			// Token: 0x170010A2 RID: 4258
			// (get) Token: 0x06004FA9 RID: 20393 RVA: 0x0016B1F5 File Offset: 0x001693F5
			public override TextObject Title
			{
				get
				{
					TextObject textObject = new TextObject("{=xxZeGhqf}{MALE_LESSER_NOBLE_NAME}{.o} Revolt", null);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x170010A3 RID: 4259
			// (get) Token: 0x06004FAA RID: 20394 RVA: 0x0016B214 File Offset: 0x00169414
			private TextObject LesserNobleTitle
			{
				get
				{
					return LesserNobleRevoltIssueBehavior.GetLesserNobleTitle(base.QuestGiver);
				}
			}

			// Token: 0x170010A4 RID: 4260
			// (get) Token: 0x06004FAB RID: 20395 RVA: 0x0016B221 File Offset: 0x00169421
			public override bool IsRemainingTimeHidden
			{
				get
				{
					return true;
				}
			}

			// Token: 0x170010A5 RID: 4261
			// (get) Token: 0x06004FAC RID: 20396 RVA: 0x0016B224 File Offset: 0x00169424
			private TextObject QuestStartedLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=ARXvmC1v}{QUEST_GIVER.LINK} says that a {MALE_LESSER_NOBLE_TITLE} named {MALE_LESSER_NOBLE_NAME} is stirring up unrest in the countryside. {?QUEST_GIVER.GENDER}She{?}He{\\?} asked you to disperse {MALE_LESSER_NOBLE_NAME}'s band using whatever means necessary before the movement gets enough support.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_TITLE", this.LesserNobleTitle);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x170010A6 RID: 4262
			// (get) Token: 0x06004FAD RID: 20397 RVA: 0x0016B27C File Offset: 0x0016947C
			private TextObject QuestCanceledWarDeclared
			{
				get
				{
					TextObject textObject = new TextObject("{=vW6kBki9}Your clan is now at war with {QUEST_GIVER.LINK}'s realm. Your agreement with {QUEST_GIVER.LINK} is canceled.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x170010A7 RID: 4263
			// (get) Token: 0x06004FAE RID: 20398 RVA: 0x0016B2B0 File Offset: 0x001694B0
			private TextObject PlayerDeclaredWarQuestLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=bqeWVVEE}Your actions have started a war with {QUEST_GIVER.LINK}'s faction. {?QUEST_GIVER.GENDER}She{?}He{\\?} cancels your agreement and the quest is a failure.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x170010A8 RID: 4264
			// (get) Token: 0x06004FAF RID: 20399 RVA: 0x0016B2E2 File Offset: 0x001694E2
			private TextObject QuestLesserNoblePartyLocationLog
			{
				get
				{
					TextObject textObject = new TextObject("{=dEXpZOlC}{QUEST_GIVER}{.o} informants reported that {MALE_LESSER_NOBLE_NAME}{.o} party has been seen near {VILLAGE}.", null);
					textObject.SetTextVariable("QUEST_GIVER", base.QuestGiver.EncyclopediaLinkWithName);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x170010A9 RID: 4265
			// (get) Token: 0x06004FB0 RID: 20400 RVA: 0x0016B318 File Offset: 0x00169518
			private TextObject QuestFailedAfterTalkingWithLesserNoblePartyLog
			{
				get
				{
					TextObject textObject = new TextObject("{=RybVf6Nt}You were convinced by {MALE_LESSER_NOBLE_NAME} to let him gather support. {QUEST_GIVER.LINK} will be very upset about this.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x170010AA RID: 4266
			// (get) Token: 0x06004FB1 RID: 20401 RVA: 0x0016B35C File Offset: 0x0016955C
			private TextObject QuestSuccessPlayerComesToAnAgreementWithLesserNoblePartyLog
			{
				get
				{
					TextObject textObject = new TextObject("{=RY8Fglsk}You have persuaded {MALE_LESSER_NOBLE_NAME} to disband his party and return home. You received {REWARD}{GOLD_ICON} in return for your service.", null);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					textObject.SetTextVariable("REWARD", this.RewardGold);
					return textObject;
				}
			}

			// Token: 0x170010AB RID: 4267
			// (get) Token: 0x06004FB2 RID: 20402 RVA: 0x0016B390 File Offset: 0x00169590
			private TextObject QuestFailWithPlayerDefeatedAgainstNobleParty
			{
				get
				{
					TextObject textObject = new TextObject("{=R3aVlXGu}You lost the battle against {MALE_LESSER_NOBLE_NAME} and failed to help {QUEST_GIVER.LINK} as promised.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x170010AC RID: 4268
			// (get) Token: 0x06004FB3 RID: 20403 RVA: 0x0016B3D4 File Offset: 0x001695D4
			private TextObject QuestSuccessWithPlayerDefeatedNobleParty
			{
				get
				{
					TextObject textObject = new TextObject("{=aKrzoAsh}You have defeated {MALE_LESSER_NOBLE_NAME} and helped {QUEST_GIVER.LINK} as promised. You received {REWARD}{GOLD_ICON} in return for your service.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					textObject.SetTextVariable("REWARD", this.RewardGold);
					return textObject;
				}
			}

			// Token: 0x170010AD RID: 4269
			// (get) Token: 0x06004FB4 RID: 20404 RVA: 0x0016B42C File Offset: 0x0016962C
			private TextObject QuestFailedWithTimeOutLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=zhzh4yd1}You failed to stop {MALE_LESSER_NOBLE_NAME} before he stirred up unrest in the countryside. {QUEST_GIVER.LINK} will be very upset about this.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
					return textObject;
				}
			}

			// Token: 0x06004FB5 RID: 20405 RVA: 0x0016B470 File Offset: 0x00169670
			private TextObject GetQuestCanceledOnClanChangedKingdomLogText(Kingdom oldKingdom)
			{
				TextObject textObject = new TextObject("{=lHNgL7Xn}{QUEST_GIVER.LINK} has left {KINGDOM}. Your agreement with {?QUEST_GIVER.GENDER}her{?}him{\\?} has been canceled.", null);
				StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
				textObject.SetTextVariable("KINGDOM", oldKingdom.Name);
				return textObject;
			}

			// Token: 0x06004FB6 RID: 20406 RVA: 0x0016B4B4 File Offset: 0x001696B4
			public LesserNobleRevoltIssueQuest(string questId, Hero giverHero, CampaignTime duration, int rewardGold, TextObject lesserNobleName) : base(questId, giverHero, duration, rewardGold)
			{
				this._lesserNobleName = lesserNobleName;
				this._tier5Troop = CharacterHelper.GetTroopTree(giverHero.Culture.EliteBasicTroop, 5f, 5f).First<CharacterObject>();
				this._tier6Troop = CharacterHelper.GetTroopTree(giverHero.Culture.EliteBasicTroop, 6f, 6f).First<CharacterObject>();
				this.SetDialogs();
				base.InitializeQuestOnCreation();
				this.CollectSuitableVillages();
				this.SpawnLesserNobleParty();
				this._rewardGold = 150 * this._lesserNobleParty.MemberRoster.TotalManCount;
			}

			// Token: 0x06004FB7 RID: 20407 RVA: 0x0016B554 File Offset: 0x00169754
			private void CollectSuitableVillages()
			{
				this._suitableVillagesToVisitList = new List<Settlement>();
				this._visitedVillagesList = new List<Settlement>();
				foreach (Settlement settlement in base.QuestGiver.Clan.Settlements)
				{
					if (settlement.IsVillage && !settlement.IsUnderRaid && !settlement.IsRaided)
					{
						this._suitableVillagesToVisitList.Add(settlement);
					}
				}
				IMapPoint questGiverLocation = base.QuestGiver.GetMapPoint();
				if (questGiverLocation == null)
				{
					questGiverLocation = base.QuestGiver.HomeSettlement;
				}
				this._suitableVillagesToVisitList = this._suitableVillagesToVisitList.OrderBy(delegate(Settlement x)
				{
					MapDistanceModel mapDistanceModel = Campaign.Current.Models.MapDistanceModel;
					Vec2 position2D = questGiverLocation.Position2D;
					float num;
					return mapDistanceModel.GetDistance(x, position2D, 150f, out num);
				}).ToList<Settlement>();
			}

			// Token: 0x06004FB8 RID: 20408 RVA: 0x0016B638 File Offset: 0x00169838
			private void SpawnLesserNobleParty()
			{
				this._lesserNobleParty = MobileParty.CreateParty("lesser_noble_party_" + base.StringId, null, new PartyComponent.OnPartyComponentCreatedDelegate(this.OnLesserPartySpawned));
			}

			// Token: 0x06004FB9 RID: 20409 RVA: 0x0016B664 File Offset: 0x00169864
			private void OnLesserPartySpawned(MobileParty lesserNobleParty)
			{
				lesserNobleParty.SetPartyUsedByQuest(true);
				TextObject textObject = new TextObject("{=WhHDg7ag}{MALE_LESSER_NOBLE_NAME}{.o} Party", null);
				textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
				Settlement settlement = this._suitableVillagesToVisitList[1];
				lesserNobleParty.InitializeMobilePartyAtPosition(new TroopRoster(lesserNobleParty.Party), new TroopRoster(lesserNobleParty.Party), settlement.Position2D);
				lesserNobleParty.SetCustomName(textObject);
				base.AddTrackedObject(lesserNobleParty);
				base.AddTrackedObject(settlement);
				lesserNobleParty.Ai.SetDoNotMakeNewDecisions(true);
				lesserNobleParty.IgnoreByOtherPartiesTill(CampaignTime.Never);
				lesserNobleParty.SetCustomHomeSettlement(base.QuestGiver.HomeSettlement);
				lesserNobleParty.MemberRoster.AddToCounts(this._tier5Troop, MathF.Min(40, MobileParty.MainParty.Party.PartySizeLimit / 2), false, 0, 0, true, -1);
				SetPartyAiAction.GetActionForVisitingSettlement(lesserNobleParty, settlement);
				TextObject textObject2 = new TextObject("{=Y2Z6F5Fj}Support level of {MALE_LESSER_NOBLE_NAME}", null);
				textObject2.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
				this._discreteLog = base.AddDiscreteLog(this.QuestStartedLogText, textObject2, 0, 20, null, false);
			}

			// Token: 0x06004FBA RID: 20410 RVA: 0x0016B770 File Offset: 0x00169970
			private DialogFlow GetLesserNoblePartyDialogFlow()
			{
				TextObject textObject = new TextObject("{=0L79bLR5}Sedition? You have been misinformed. My men and I are loyal servants of {RULER_NAME_AND_TITLE}. We are simply going about informing the people that our {RULER_TITLE} is surrounded by bad advisers who wish to raise their taxes. We petition {RULER.NAME} to listen to {?RULER.GENDER}her{?}his{\\?} people and their needs.[if:convo_normal][ib:hip]", null);
				textObject.SetTextVariable("RULER_NAME_AND_TITLE", GameTexts.FindText("str_faction_ruler_name_with_title", base.QuestGiver.Culture.StringId));
				textObject.SetTextVariable("RULER_TITLE", GameTexts.FindText("str_faction_ruler", base.QuestGiver.Culture.StringId));
				TextObject npcText = new TextObject("{=p14S00jq}Consequences? You would shed the blood of {RULER.NAME}'s loyal servants just for raising their voices against oppression?[if:convo_confused_normal][ib:closed]", null);
				StringHelpers.SetCharacterProperties("RULER", base.QuestGiver.MapFaction.Leader.CharacterObject, null, false);
				DialogFlow dialogFlow = DialogFlow.CreateDialogFlow("start", 125).NpcLine(new TextObject("{=!}{MALE_LESSER_NOBLE_PARTY_START_LINE}", null), null, null).Condition(new ConversationSentence.OnConditionDelegate(this.SetStartDialogOnCondition)).PlayerLine(new TextObject("{=XkjRNMam}You have no right to go around, under arms, spreading sedition. Disperse!", null), null).NpcLine(textObject, null, null).Consequence(delegate
				{
					this._task = this.GetPersuasionTask();
				}).BeginPlayerOptions().PlayerOption(new TextObject("{=dxTSVT4C}Yes, that's sedition all right. Disperse now or face the consequences.", null), null).NpcLine(npcText, null, null).BeginPlayerOptions().PlayerOption(new TextObject("{=GdC4yKiO}I will talk no more. Get ready to fight.", null), null).NpcLine(new TextObject("{=7VLmHrgC}The Heavens will grant victory to the just![ib:warrior][if:convo_contemptuous]", null), null, null).Consequence(delegate
				{
					EncounterManager.StartPartyEncounter(PartyBase.MainParty, this._lesserNobleParty.Party);
					Campaign.Current.GameMenuManager.SetNextMenu("encounter");
				}).CloseDialog().PlayerOption(new TextObject("{=RTNK5FSs}No, I don't want to shed your blood.", null), null).NpcLine(new TextObject("{=izzbaMUf}Wise decision.[if:convo_undecided_closed][ib:normal]", null), null, null).GotoDialogState("start").EndPlayerOptions().PlayerOption("{=UTaXn4pb}Well, I have indeed been misinformed. You may go on your way...", null).NpcLine("{=8nGRa1pO}You're doing a good thing, {?PLAYER.GENDER}madame{?}sir{\\?}. The poor people around here will remember you", null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(this.QuestFailedAfterTalkingWithLesserNobleParty)).CloseDialog().PlayerOption("{=etYcn79b}Let me try to talk some sense into you...", null).Condition(() => !this._persuasionTriedOnce).Consequence(delegate
				{
					this._persuasionTriedOnce = true;
				}).GotoDialogState("start_lesser_noble_party_persuasion").EndPlayerOptions();
				this.AddPersuasionDialogs(dialogFlow);
				return dialogFlow;
			}

			// Token: 0x06004FBB RID: 20411 RVA: 0x0016B95C File Offset: 0x00169B5C
			private bool SetStartDialogOnCondition()
			{
				if (this._lesserNobleParty != null && CharacterObject.OneToOneConversationCharacter == ConversationHelper.GetConversationCharacterPartyLeader(this._lesserNobleParty.Party))
				{
					MBTextManager.SetTextVariable("MALE_LESSER_NOBLE_PARTY_START_LINE", "{=ZqjiBjYJ}Greetings, {?PLAYER.GENDER}madame{?}sir{\\?}. May I help you?", false);
					if (this._persuasionTriedOnce || this._firstTalkIsDone)
					{
						MBTextManager.SetTextVariable("MALE_LESSER_NOBLE_PARTY_START_LINE", "{=Nn06TSq9}Anything else to say?", false);
					}
					this._firstTalkIsDone = true;
					return true;
				}
				return false;
			}

			// Token: 0x06004FBC RID: 20412 RVA: 0x0016B9C4 File Offset: 0x00169BC4
			private void AddPersuasionDialogs(DialogFlow dialog)
			{
				dialog.AddDialogLine("lesser_party_persuasion_check_accepted", "start_lesser_noble_party_persuasion", "lesser_party_persuasion_start_reservation", "{=FwtFtpwp}How?", null, new ConversationSentence.OnConsequenceDelegate(this.persuasion_start_with_lesser_party_on_consequence), this, 100, null, null, null);
				dialog.AddDialogLine("lesser_party_persuasion_rejected", "lesser_party_persuasion_start_reservation", "start", "{=!}{FAILED_PERSUASION_LINE}", new ConversationSentence.OnConditionDelegate(this.persuasion_failed_with_lesser_party_on_condition), new ConversationSentence.OnConsequenceDelegate(this.persuasion_rejected_with_lesser_party_on_consequence), this, 100, null, null, null);
				dialog.AddDialogLine("lesser_party_persuasion_attempt", "lesser_party_persuasion_start_reservation", "lesser_party_persuasion_select_option", "{=wM77S68a}What's there to discuss?", () => !this.persuasion_failed_with_lesser_party_on_condition(), null, this, 100, null, null, null);
				dialog.AddDialogLine("lesser_party_persuasion_success", "lesser_party_persuasion_start_reservation", "close_window", "{=zWILNszA}You may have a point, but don't think that we will give up demanding our rights. We will return home, but we will pursue our grievances some other way.", new ConversationSentence.OnConditionDelegate(ConversationManager.GetPersuasionProgressSatisfied), new ConversationSentence.OnConsequenceDelegate(this.persuasion_complete_with_lesser_party_on_consequence), this, 200, null, null, null);
				string id = "lesser_party_persuasion_select_option_1";
				string inputToken = "lesser_party_persuasion_select_option";
				string outputToken = "lesser_party_persuasion_selected_option_response";
				string text = "{=!}{LESSER_PARTY_PERSUADE_ATTEMPT_1}";
				ConversationSentence.OnConditionDelegate conditionDelegate = new ConversationSentence.OnConditionDelegate(this.lesser_party_persuasion_select_option_1_on_condition);
				ConversationSentence.OnConsequenceDelegate consequenceDelegate = new ConversationSentence.OnConsequenceDelegate(this.lesser_party_persuasion_select_option_1_on_consequence);
				ConversationSentence.OnPersuasionOptionDelegate persuasionOptionDelegate = new ConversationSentence.OnPersuasionOptionDelegate(this.lesser_party_persuasion_setup_option_1);
				ConversationSentence.OnClickableConditionDelegate clickableConditionDelegate = new ConversationSentence.OnClickableConditionDelegate(this.lesser_party_persuasion_clickable_option_1_on_condition);
				dialog.AddPlayerLine(id, inputToken, outputToken, text, conditionDelegate, consequenceDelegate, this, 100, clickableConditionDelegate, persuasionOptionDelegate, null, null);
				string id2 = "lesser_party_persuasion_select_option_2";
				string inputToken2 = "lesser_party_persuasion_select_option";
				string outputToken2 = "lesser_party_persuasion_selected_option_response";
				string text2 = "{=!}{LESSER_PARTY_PERSUADE_ATTEMPT_2}";
				ConversationSentence.OnConditionDelegate conditionDelegate2 = new ConversationSentence.OnConditionDelegate(this.lesser_party_persuasion_select_option_2_on_condition);
				ConversationSentence.OnConsequenceDelegate consequenceDelegate2 = new ConversationSentence.OnConsequenceDelegate(this.lesser_party_persuasion_select_option_2_on_consequence);
				persuasionOptionDelegate = new ConversationSentence.OnPersuasionOptionDelegate(this.lesser_party_persuasion_setup_option_2);
				clickableConditionDelegate = new ConversationSentence.OnClickableConditionDelegate(this.lesser_party_persuasion_clickable_option_2_on_condition);
				dialog.AddPlayerLine(id2, inputToken2, outputToken2, text2, conditionDelegate2, consequenceDelegate2, this, 100, clickableConditionDelegate, persuasionOptionDelegate, null, null);
				string id3 = "lesser_party_persuasion_select_option_3";
				string inputToken3 = "lesser_party_persuasion_select_option";
				string outputToken3 = "lesser_party_persuasion_selected_option_response";
				string text3 = "{=!}{LESSER_PARTY_PERSUADE_ATTEMPT_3}";
				ConversationSentence.OnConditionDelegate conditionDelegate3 = new ConversationSentence.OnConditionDelegate(this.lesser_party_persuasion_select_option_3_on_condition);
				ConversationSentence.OnConsequenceDelegate consequenceDelegate3 = new ConversationSentence.OnConsequenceDelegate(this.lesser_party_persuasion_select_option_3_on_consequence);
				persuasionOptionDelegate = new ConversationSentence.OnPersuasionOptionDelegate(this.lesser_party_persuasion_setup_option_3);
				clickableConditionDelegate = new ConversationSentence.OnClickableConditionDelegate(this.lesser_party_persuasion_clickable_option_3_on_condition);
				dialog.AddPlayerLine(id3, inputToken3, outputToken3, text3, conditionDelegate3, consequenceDelegate3, this, 100, clickableConditionDelegate, persuasionOptionDelegate, null, null);
				string id4 = "lesser_party_persuasion_select_option_4";
				string inputToken4 = "lesser_party_persuasion_select_option";
				string outputToken4 = "lesser_party_persuasion_selected_option_response";
				string text4 = "{=!}{LESSER_PARTY_PERSUADE_ATTEMPT_4}";
				ConversationSentence.OnConditionDelegate conditionDelegate4 = new ConversationSentence.OnConditionDelegate(this.lesser_party_persuasion_select_option_4_on_condition);
				ConversationSentence.OnConsequenceDelegate consequenceDelegate4 = new ConversationSentence.OnConsequenceDelegate(this.lesser_party_persuasion_select_option_4_on_consequence);
				persuasionOptionDelegate = new ConversationSentence.OnPersuasionOptionDelegate(this.lesser_party_persuasion_setup_option_4);
				clickableConditionDelegate = new ConversationSentence.OnClickableConditionDelegate(this.lesser_party_persuasion_clickable_option_4_on_condition);
				dialog.AddPlayerLine(id4, inputToken4, outputToken4, text4, conditionDelegate4, consequenceDelegate4, this, 100, clickableConditionDelegate, persuasionOptionDelegate, null, null);
				dialog.AddDialogLine("lesser_party_persuasion_select_option_reaction", "lesser_party_persuasion_selected_option_response", "lesser_party_persuasion_start_reservation", "{=!}{PERSUASION_REACTION}", new ConversationSentence.OnConditionDelegate(this.lesser_party_persuasion_selected_option_response_on_condition), new ConversationSentence.OnConsequenceDelegate(this.lesser_party_persuasion_selected_option_response_on_consequence), this, 100, null, null, null);
			}

			// Token: 0x06004FBD RID: 20413 RVA: 0x0016BC2B File Offset: 0x00169E2B
			private void persuasion_start_with_lesser_party_on_consequence()
			{
				ConversationManager.StartPersuasion(2f, 1f, 0f, 2f, 2f, 0f, PersuasionDifficulty.MediumHard);
			}

			// Token: 0x06004FBE RID: 20414 RVA: 0x0016BC54 File Offset: 0x00169E54
			private PersuasionTask GetPersuasionTask()
			{
				PersuasionTask persuasionTask = new PersuasionTask(0)
				{
					FinalFailLine = new TextObject("{=W7c3BfIX}Thus always spoke the tyrant to the oppressed! We can only pray that the Heavens help the just. Now stay out of my way.[if:convo_undecided_closed][ib:closed]", null),
					TryLaterLine = TextObject.Empty,
					SpokenLine = new TextObject("{=wM77S68a}What's there to discuss?", null)
				};
				PersuasionOptionArgs option = new PersuasionOptionArgs(DefaultSkills.Charm, DefaultTraits.Mercy, TraitEffect.Positive, PersuasionArgumentStrength.Normal, false, new TextObject("{=JDGz56HX}If you start a rebellion, you're just going to get a lot of peasants around here killed...", null), null, false, false, false);
				persuasionTask.AddOptionToTask(option);
				PersuasionOptionArgs option2 = new PersuasionOptionArgs(DefaultSkills.Charm, DefaultTraits.Calculating, TraitEffect.Positive, PersuasionArgumentStrength.Normal, true, new TextObject("{=s99TKI9x}The nobles aren't trying to starve anyone, but if they don't collect taxes, they won't be able to fight off raiders.", null), null, false, false, false);
				persuasionTask.AddOptionToTask(option2);
				PersuasionOptionArgs option3 = new PersuasionOptionArgs(DefaultSkills.Roguery, DefaultTraits.Calculating, TraitEffect.Positive, PersuasionArgumentStrength.Normal, false, new TextObject("{=TCSggNOS}You know the dark hearts of men... Those who start as rebels end up turning bandit. Rebellion brings anarchy, not justice. ", null), null, false, false, false);
				persuasionTask.AddOptionToTask(option3);
				if (MobileParty.MainParty.MemberRoster.TotalHealthyCount >= this._lesserNobleParty.MemberRoster.TotalHealthyCount * 3)
				{
					TextObject line = new TextObject("{=IP3e4x8S}Count my troops. Then count yours. You have no chance.", null);
					PersuasionOptionArgs option4 = new PersuasionOptionArgs(DefaultSkills.Charm, DefaultTraits.Honor, TraitEffect.Positive, PersuasionArgumentStrength.Easy, false, line, null, false, false, false);
					persuasionTask.AddOptionToTask(option4);
				}
				return persuasionTask;
			}

			// Token: 0x06004FBF RID: 20415 RVA: 0x0016BD64 File Offset: 0x00169F64
			private bool lesser_party_persuasion_selected_option_response_on_condition()
			{
				PersuasionOptionResult item = ConversationManager.GetPersuasionChosenOptions().Last<Tuple<PersuasionOptionArgs, PersuasionOptionResult>>().Item2;
				MBTextManager.SetTextVariable("PERSUASION_REACTION", PersuasionHelper.GetDefaultPersuasionOptionReaction(item), false);
				if (item == PersuasionOptionResult.CriticalFailure)
				{
					this._task.BlockAllOptions();
				}
				return true;
			}

			// Token: 0x06004FC0 RID: 20416 RVA: 0x0016BDA4 File Offset: 0x00169FA4
			private void lesser_party_persuasion_selected_option_response_on_consequence()
			{
				Tuple<PersuasionOptionArgs, PersuasionOptionResult> tuple = ConversationManager.GetPersuasionChosenOptions().Last<Tuple<PersuasionOptionArgs, PersuasionOptionResult>>();
				float difficulty = Campaign.Current.Models.PersuasionModel.GetDifficulty(PersuasionDifficulty.MediumHard);
				float moveToNextStageChance;
				float blockRandomOptionChance;
				Campaign.Current.Models.PersuasionModel.GetEffectChances(tuple.Item1, out moveToNextStageChance, out blockRandomOptionChance, difficulty);
				this._task.ApplyEffects(moveToNextStageChance, blockRandomOptionChance);
			}

			// Token: 0x06004FC1 RID: 20417 RVA: 0x0016BE00 File Offset: 0x0016A000
			private bool lesser_party_persuasion_select_option_1_on_condition()
			{
				if (this._task.Options.Count > 0)
				{
					TextObject textObject = new TextObject("{=bSo9hKwr}{PERSUASION_OPTION_LINE} {SUCCESS_CHANCE}", null);
					textObject.SetTextVariable("SUCCESS_CHANCE", PersuasionHelper.ShowSuccess(this._task.Options.ElementAt(0), false));
					textObject.SetTextVariable("PERSUASION_OPTION_LINE", this._task.Options.ElementAt(0).Line);
					MBTextManager.SetTextVariable("LESSER_PARTY_PERSUADE_ATTEMPT_1", textObject, false);
					return true;
				}
				return false;
			}

			// Token: 0x06004FC2 RID: 20418 RVA: 0x0016BE80 File Offset: 0x0016A080
			private bool lesser_party_persuasion_select_option_2_on_condition()
			{
				if (this._task.Options.Count > 1)
				{
					TextObject textObject = new TextObject("{=bSo9hKwr}{PERSUASION_OPTION_LINE} {SUCCESS_CHANCE}", null);
					textObject.SetTextVariable("SUCCESS_CHANCE", PersuasionHelper.ShowSuccess(this._task.Options.ElementAt(1), false));
					textObject.SetTextVariable("PERSUASION_OPTION_LINE", this._task.Options.ElementAt(1).Line);
					MBTextManager.SetTextVariable("LESSER_PARTY_PERSUADE_ATTEMPT_2", textObject, false);
					return true;
				}
				return false;
			}

			// Token: 0x06004FC3 RID: 20419 RVA: 0x0016BF00 File Offset: 0x0016A100
			private bool lesser_party_persuasion_select_option_3_on_condition()
			{
				if (this._task.Options.Count > 2)
				{
					TextObject textObject = new TextObject("{=bSo9hKwr}{PERSUASION_OPTION_LINE} {SUCCESS_CHANCE}", null);
					textObject.SetTextVariable("SUCCESS_CHANCE", PersuasionHelper.ShowSuccess(this._task.Options.ElementAt(2), false));
					textObject.SetTextVariable("PERSUASION_OPTION_LINE", this._task.Options.ElementAt(2).Line);
					MBTextManager.SetTextVariable("LESSER_PARTY_PERSUADE_ATTEMPT_3", textObject, false);
					return true;
				}
				return false;
			}

			// Token: 0x06004FC4 RID: 20420 RVA: 0x0016BF80 File Offset: 0x0016A180
			private bool lesser_party_persuasion_select_option_4_on_condition()
			{
				if (this._task.Options.Count > 3)
				{
					TextObject textObject = new TextObject("{=bSo9hKwr}{PERSUASION_OPTION_LINE} {SUCCESS_CHANCE}", null);
					textObject.SetTextVariable("SUCCESS_CHANCE", PersuasionHelper.ShowSuccess(this._task.Options.ElementAt(3), false));
					textObject.SetTextVariable("PERSUASION_OPTION_LINE", this._task.Options.ElementAt(3).Line);
					MBTextManager.SetTextVariable("LESSER_PARTY_PERSUADE_ATTEMPT_4", textObject, false);
					return true;
				}
				return false;
			}

			// Token: 0x06004FC5 RID: 20421 RVA: 0x0016C000 File Offset: 0x0016A200
			private void lesser_party_persuasion_select_option_1_on_consequence()
			{
				if (this._task.Options.Count > 0)
				{
					this._task.Options[0].BlockTheOption(true);
				}
			}

			// Token: 0x06004FC6 RID: 20422 RVA: 0x0016C02C File Offset: 0x0016A22C
			private void lesser_party_persuasion_select_option_2_on_consequence()
			{
				if (this._task.Options.Count > 1)
				{
					this._task.Options[1].BlockTheOption(true);
				}
			}

			// Token: 0x06004FC7 RID: 20423 RVA: 0x0016C058 File Offset: 0x0016A258
			private void lesser_party_persuasion_select_option_3_on_consequence()
			{
				if (this._task.Options.Count > 2)
				{
					this._task.Options[2].BlockTheOption(true);
				}
			}

			// Token: 0x06004FC8 RID: 20424 RVA: 0x0016C084 File Offset: 0x0016A284
			private void lesser_party_persuasion_select_option_4_on_consequence()
			{
				if (this._task.Options.Count > 3)
				{
					this._task.Options[3].BlockTheOption(true);
				}
			}

			// Token: 0x06004FC9 RID: 20425 RVA: 0x0016C0B0 File Offset: 0x0016A2B0
			private bool persuasion_failed_with_lesser_party_on_condition()
			{
				if (this._task.Options.All((PersuasionOptionArgs x) => x.IsBlocked) && !ConversationManager.GetPersuasionProgressSatisfied())
				{
					MBTextManager.SetTextVariable("FAILED_PERSUASION_LINE", this._task.FinalFailLine, false);
					return true;
				}
				return false;
			}

			// Token: 0x06004FCA RID: 20426 RVA: 0x0016C10E File Offset: 0x0016A30E
			private PersuasionOptionArgs lesser_party_persuasion_setup_option_1()
			{
				return this._task.Options.ElementAt(0);
			}

			// Token: 0x06004FCB RID: 20427 RVA: 0x0016C121 File Offset: 0x0016A321
			private PersuasionOptionArgs lesser_party_persuasion_setup_option_2()
			{
				return this._task.Options.ElementAt(1);
			}

			// Token: 0x06004FCC RID: 20428 RVA: 0x0016C134 File Offset: 0x0016A334
			private PersuasionOptionArgs lesser_party_persuasion_setup_option_3()
			{
				return this._task.Options.ElementAt(2);
			}

			// Token: 0x06004FCD RID: 20429 RVA: 0x0016C147 File Offset: 0x0016A347
			private PersuasionOptionArgs lesser_party_persuasion_setup_option_4()
			{
				return this._task.Options.ElementAt(3);
			}

			// Token: 0x06004FCE RID: 20430 RVA: 0x0016C15C File Offset: 0x0016A35C
			private bool lesser_party_persuasion_clickable_option_1_on_condition(out TextObject hintText)
			{
				hintText = new TextObject("{=9ACJsI6S}Blocked", null);
				if (this._task.Options.Count > 0)
				{
					hintText = (this._task.Options.ElementAt(0).IsBlocked ? hintText : TextObject.Empty);
					return !this._task.Options.ElementAt(0).IsBlocked;
				}
				return false;
			}

			// Token: 0x06004FCF RID: 20431 RVA: 0x0016C1C8 File Offset: 0x0016A3C8
			private bool lesser_party_persuasion_clickable_option_2_on_condition(out TextObject hintText)
			{
				hintText = new TextObject("{=9ACJsI6S}Blocked", null);
				if (this._task.Options.Count > 1)
				{
					hintText = (this._task.Options.ElementAt(1).IsBlocked ? hintText : TextObject.Empty);
					return !this._task.Options.ElementAt(1).IsBlocked;
				}
				return false;
			}

			// Token: 0x06004FD0 RID: 20432 RVA: 0x0016C234 File Offset: 0x0016A434
			private bool lesser_party_persuasion_clickable_option_3_on_condition(out TextObject hintText)
			{
				hintText = new TextObject("{=9ACJsI6S}Blocked", null);
				if (this._task.Options.Count > 2)
				{
					hintText = (this._task.Options.ElementAt(2).IsBlocked ? hintText : TextObject.Empty);
					return !this._task.Options.ElementAt(2).IsBlocked;
				}
				return false;
			}

			// Token: 0x06004FD1 RID: 20433 RVA: 0x0016C2A0 File Offset: 0x0016A4A0
			private bool lesser_party_persuasion_clickable_option_4_on_condition(out TextObject hintText)
			{
				hintText = new TextObject("{=9ACJsI6S}Blocked", null);
				if (this._task.Options.Count > 3)
				{
					hintText = (this._task.Options.ElementAt(3).IsBlocked ? hintText : TextObject.Empty);
					return !this._task.Options.ElementAt(3).IsBlocked;
				}
				return false;
			}

			// Token: 0x06004FD2 RID: 20434 RVA: 0x0016C30B File Offset: 0x0016A50B
			private void persuasion_rejected_with_lesser_party_on_consequence()
			{
				PlayerEncounter.LeaveEncounter = false;
				ConversationManager.EndPersuasion();
			}

			// Token: 0x06004FD3 RID: 20435 RVA: 0x0016C318 File Offset: 0x0016A518
			private void persuasion_complete_with_lesser_party_on_consequence()
			{
				PlayerEncounter.LeaveEncounter = true;
				ConversationManager.EndPersuasion();
				Campaign.Current.ConversationManager.ConversationEndOneShot += this.QuestSuccessPlayerComesToAnAgreementWithLesserNobleParty;
			}

			// Token: 0x06004FD4 RID: 20436 RVA: 0x0016C340 File Offset: 0x0016A540
			private bool DialogCondition()
			{
				return Hero.OneToOneConversationHero == base.QuestGiver;
			}

			// Token: 0x06004FD5 RID: 20437 RVA: 0x0016C350 File Offset: 0x0016A550
			protected override void SetDialogs()
			{
				TextObject textObject = new TextObject("{=YMGQYhvg}Thank you. {MALE_LESSER_NOBLE_NAME} is always on the move, so finding him might be tricky. But don't worry, I get regular reports from the landowners around here and I'll keep you updated on his movements...[if:convo_undecided_closed]", null);
				textObject.SetTextVariable("MALE_LESSER_NOBLE_NAME", this._lesserNobleName);
				this.OfferDialogFlow = DialogFlow.CreateDialogFlow("issue_classic_quest_start", 100).NpcLine(textObject, null, null).Condition(new ConversationSentence.OnConditionDelegate(this.DialogCondition)).Consequence(new ConversationSentence.OnConsequenceDelegate(this.QuestAcceptedConsequences)).CloseDialog();
				TextObject textObject2 = new TextObject("{=ZpabPAtS}Have you put a stop to {MALE_LESSER_NOBLE_TITLE}{.s}?[if:convo_undecided_open]", null);
				textObject2.SetTextVariable("MALE_LESSER_NOBLE_TITLE", this.LesserNobleTitle);
				this.DiscussDialogFlow = DialogFlow.CreateDialogFlow("quest_discuss", 100).NpcLine(textObject2, null, null).Condition(new ConversationSentence.OnConditionDelegate(this.DialogCondition)).BeginPlayerOptions().PlayerOption(new TextObject("{=p8ye30mG}Yes, we know where he is. It's just a matter of time to catch them.", null), null).NpcLine(new TextObject("{=2L1bZdwh}Good. I count on you.[if:convo_relaxed_happy]", null), null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(MapEventHelper.OnConversationEnd)).CloseDialog().PlayerOption(new TextObject("{=zjMqgbXz}We are working on it.", null), null).NpcLine(new TextObject("{=HRwb3qJZ}Very well. But every day he's out there spreading sedition make things more dangerous for all of us.[if:convo_undecided_closed]", null), null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(MapEventHelper.OnConversationEnd)).CloseDialog().EndPlayerOptions();
				this.QuestCharacterDialogFlow = this.GetLesserNoblePartyDialogFlow();
			}

			// Token: 0x06004FD6 RID: 20438 RVA: 0x0016C48D File Offset: 0x0016A68D
			private void QuestAcceptedConsequences()
			{
				base.StartQuest();
			}

			// Token: 0x06004FD7 RID: 20439 RVA: 0x0016C495 File Offset: 0x0016A695
			private void QuestFailedAfterTalkingWithLesserNobleParty()
			{
				PlayerEncounter.Finish(true);
				base.AddLog(this.QuestFailedAfterTalkingWithLesserNoblePartyLog, false);
				this.RelationshipChangeWithQuestGiver = -5;
				this.ChangeRelationWithRuralNotables(1);
				base.CompleteQuestWithFail(null);
			}

			// Token: 0x06004FD8 RID: 20440 RVA: 0x0016C4C4 File Offset: 0x0016A6C4
			private void QuestSuccessPlayerComesToAnAgreementWithLesserNobleParty()
			{
				base.AddLog(this.QuestSuccessPlayerComesToAnAgreementWithLesserNoblePartyLog, false);
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -10)
				});
				GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, this.RewardGold, false);
				this.RelationshipChangeWithQuestGiver = 8;
				GainRenownAction.Apply(Hero.MainHero, 1f, false);
				base.CompleteQuestWithSuccess();
			}

			// Token: 0x06004FD9 RID: 20441 RVA: 0x0016C52E File Offset: 0x0016A72E
			private void QuestFailWithPlayerDefeatedAgainstLesserNobleParty()
			{
				base.AddLog(this.QuestFailWithPlayerDefeatedAgainstNobleParty, false);
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -15)
				});
				this.RelationshipChangeWithQuestGiver = -5;
				base.CompleteQuestWithFail(null);
			}

			// Token: 0x06004FDA RID: 20442 RVA: 0x0016C570 File Offset: 0x0016A770
			private void QuestSuccessWithPlayerDefeatedLesserNobleParty()
			{
				base.AddLog(this.QuestSuccessWithPlayerDefeatedNobleParty, false);
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, 30)
				});
				GainRenownAction.Apply(Hero.MainHero, 3f, false);
				GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, this.RewardGold, false);
				this.RelationshipChangeWithQuestGiver = 8;
				this.ChangeRelationWithRuralNotables(-2);
				base.CompleteQuestWithSuccess();
			}

			// Token: 0x06004FDB RID: 20443 RVA: 0x0016C5E4 File Offset: 0x0016A7E4
			private void ChangeRelationWithRuralNotables(int value)
			{
				foreach (Settlement settlement in this._visitedVillagesList)
				{
					foreach (Hero hero in settlement.Notables)
					{
						if (hero.IsRuralNotable)
						{
							ChangeRelationAction.ApplyPlayerRelation(hero, value, true, true);
						}
					}
				}
			}

			// Token: 0x06004FDC RID: 20444 RVA: 0x0016C67C File Offset: 0x0016A87C
			protected override void OnTimedOut()
			{
				base.AddLog(this.QuestFailedWithTimeOutLogText, false);
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -10)
				});
				this.RelationshipChangeWithQuestGiver = -5;
			}

			// Token: 0x06004FDD RID: 20445 RVA: 0x0016C6B4 File Offset: 0x0016A8B4
			public override void OnFailed()
			{
				this.RelationshipChangeWithQuestGiver = -5;
			}

			// Token: 0x06004FDE RID: 20446 RVA: 0x0016C6BE File Offset: 0x0016A8BE
			protected override void HourlyTick()
			{
			}

			// Token: 0x06004FDF RID: 20447 RVA: 0x0016C6C0 File Offset: 0x0016A8C0
			protected override void RegisterEvents()
			{
				CampaignEvents.SettlementEntered.AddNonSerializedListener(this, new Action<MobileParty, Settlement, Hero>(this.OnSettlementEntered));
				CampaignEvents.HourlyTickPartyEvent.AddNonSerializedListener(this, new Action<MobileParty>(this.HourlyTickParty));
				CampaignEvents.WarDeclared.AddNonSerializedListener(this, new Action<IFaction, IFaction, DeclareWarAction.DeclareWarDetail>(this.OnWarDeclared));
				CampaignEvents.OnClanChangedKingdomEvent.AddNonSerializedListener(this, new Action<Clan, Kingdom, Kingdom, ChangeKingdomAction.ChangeKingdomActionDetail, bool>(this.OnClanChangedKingdom));
				CampaignEvents.MapEventStarted.AddNonSerializedListener(this, new Action<MapEvent, PartyBase, PartyBase>(this.OnMapEventStarted));
				CampaignEvents.GameMenuOpened.AddNonSerializedListener(this, new Action<MenuCallbackArgs>(this.OnGameMenuOpened));
				CampaignEvents.MapEventEnded.AddNonSerializedListener(this, new Action<MapEvent>(this.OnMapEventEnd));
				CampaignEvents.CanHeroBecomePrisonerEvent.AddNonSerializedListener(this, new ReferenceAction<Hero, bool>(this.OnCanHeroBecomePrisonerInfoIsRequested));
			}

			// Token: 0x06004FE0 RID: 20448 RVA: 0x0016C785 File Offset: 0x0016A985
			private void OnCanHeroBecomePrisonerInfoIsRequested(Hero hero, ref bool result)
			{
				if (hero == Hero.MainHero && this._checkForEventEnd)
				{
					result = false;
				}
			}

			// Token: 0x06004FE1 RID: 20449 RVA: 0x0016C79C File Offset: 0x0016A99C
			private void OnMapEventEnd(MapEvent obj)
			{
				if (this._checkForEventEnd)
				{
					if (PlayerEncounter.Battle.WinningSide == BattleSideEnum.None)
					{
						this.QuestFailWithPlayerDefeatedAgainstLesserNobleParty();
					}
					else if (PlayerEncounter.Battle.WinningSide == PlayerEncounter.Battle.PlayerSide)
					{
						this.QuestSuccessWithPlayerDefeatedLesserNobleParty();
					}
					else
					{
						this.QuestFailWithPlayerDefeatedAgainstLesserNobleParty();
					}
					if (this._lesserNobleParty.IsActive)
					{
						DestroyPartyAction.Apply(PartyBase.MainParty, this._lesserNobleParty);
					}
					this._checkForEventEnd = false;
				}
			}

			// Token: 0x06004FE2 RID: 20450 RVA: 0x0016C810 File Offset: 0x0016AA10
			private void OnGameMenuOpened(MenuCallbackArgs args)
			{
				if (args.MenuContext.GameMenu.StringId == "encounter" && PlayerEncounter.Battle != null && PlayerEncounter.Battle.InvolvedParties.Contains(this._lesserNobleParty.Party) && PlayerEncounter.Battle.State == MapEventState.Wait && MapEvent.PlayerMapEvent != null && MapEvent.PlayerMapEvent.InvolvedParties.Contains(this._lesserNobleParty.Party))
				{
					foreach (PartyBase partyBase in MapEvent.PlayerMapEvent.InvolvedParties.ToList<PartyBase>())
					{
						if (partyBase.IsMobile && partyBase.MobileParty.IsMilitia)
						{
							partyBase.MapEventSide = null;
						}
					}
				}
			}

			// Token: 0x06004FE3 RID: 20451 RVA: 0x0016C8FC File Offset: 0x0016AAFC
			private void OnMapEventStarted(MapEvent mapEvent, PartyBase attackerParty, PartyBase defenderParty)
			{
				if (QuestHelper.CheckMinorMajorCoercion(this, mapEvent, attackerParty))
				{
					QuestHelper.ApplyGenericMinorMajorCoercionConsequences(this, mapEvent);
				}
				if (base.IsOngoing && attackerParty == PartyBase.MainParty && defenderParty == this._lesserNobleParty.Party)
				{
					this._checkForEventEnd = true;
				}
			}

			// Token: 0x06004FE4 RID: 20452 RVA: 0x0016C934 File Offset: 0x0016AB34
			private void HourlyTickParty(MobileParty mobileParty)
			{
				if (mobileParty == this._lesserNobleParty)
				{
					if (this._lesserNobleParty.TargetSettlement == null)
					{
						if (this._goOutFromSettlementAfterHoursCounter > 0)
						{
							this._goOutFromSettlementAfterHoursCounter--;
						}
						if (this._goOutFromSettlementAfterHoursCounter == 0)
						{
							if (this._suitableVillagesToVisitList.Count == 0)
							{
								this.CollectSuitableVillages();
							}
							if (this._suitableVillagesToVisitList.Count > 0)
							{
								IOrderedEnumerable<Settlement> source = from x in this._suitableVillagesToVisitList
								orderby x.Position2D.DistanceSquared(this._lesserNobleParty.Position2D)
								select x;
								SetPartyAiAction.GetActionForVisitingSettlement(this._lesserNobleParty, source.First<Settlement>());
							}
							else
							{
								this._goOutFromSettlementAfterHoursCounter = 5;
							}
						}
					}
					if (this._giveNotificationAfterHoursCounter > 0)
					{
						this._giveNotificationAfterHoursCounter--;
					}
					if (this._giveNotificationAfterHoursCounter == 0 && this._visitedVillagesList.Count > 0)
					{
						TextObject questLesserNoblePartyLocationLog = this.QuestLesserNoblePartyLocationLog;
						questLesserNoblePartyLocationLog.SetTextVariable("VILLAGE", this._visitedVillagesList[this._visitedVillagesList.Count - 1].EncyclopediaLinkWithName);
						MBInformationManager.AddQuickInformation(questLesserNoblePartyLocationLog, 0, null, "");
						base.AddLog(questLesserNoblePartyLocationLog, false);
						foreach (Settlement settlement in this._visitedVillagesList)
						{
							if (base.IsTracked(settlement))
							{
								base.RemoveTrackedObject(settlement);
							}
						}
						base.AddTrackedObject(this._visitedVillagesList[this._visitedVillagesList.Count - 1]);
						this._giveNotificationAfterHoursCounter = -1;
					}
				}
			}

			// Token: 0x06004FE5 RID: 20453 RVA: 0x0016CABC File Offset: 0x0016ACBC
			private void OnSettlementEntered(MobileParty party, Settlement settlement, Hero hero)
			{
				if (party == this._lesserNobleParty)
				{
					this._visitedVillagesList.Add(settlement);
					this._suitableVillagesToVisitList.Remove(settlement);
					this._goOutFromSettlementAfterHoursCounter = 5;
					this._giveNotificationAfterHoursCounter = 9;
					if (80 > this._lesserNobleParty.MemberRoster.TotalManCount)
					{
						this._lesserNobleParty.MemberRoster.AddToCounts(((double)MBRandom.RandomFloat < 0.7) ? this._tier5Troop : this._tier6Troop, (MBRandom.RandomFloat < 0.5f) ? 3 : 4, false, 0, 0, true, -1);
					}
					this._lesserNobleParty.ItemRoster.AddToCounts(DefaultItems.Grain, 5);
					this._discreteLog.UpdateCurrentProgress(this._discreteLog.CurrentProgress + 1);
					if (this._discreteLog.CurrentProgress == 20)
					{
						this.OnTimedOut();
						base.CompleteQuestWithFail(null);
					}
				}
			}

			// Token: 0x06004FE6 RID: 20454 RVA: 0x0016CBA4 File Offset: 0x0016ADA4
			private void OnClanChangedKingdom(Clan clan, Kingdom oldKingdom, Kingdom newKingdom, ChangeKingdomAction.ChangeKingdomActionDetail detail, bool showNotification = true)
			{
				if (base.QuestGiver.MapFaction.IsAtWarWith(Hero.MainHero.MapFaction))
				{
					base.CompleteQuestWithCancel(this.QuestCanceledWarDeclared);
					return;
				}
				if (clan == base.QuestGiver.Clan)
				{
					base.CompleteQuestWithCancel(this.GetQuestCanceledOnClanChangedKingdomLogText(oldKingdom));
				}
			}

			// Token: 0x06004FE7 RID: 20455 RVA: 0x0016CBF5 File Offset: 0x0016ADF5
			private void OnWarDeclared(IFaction faction1, IFaction faction2, DeclareWarAction.DeclareWarDetail detail)
			{
				QuestHelper.CheckWarDeclarationAndFailOrCancelTheQuest(this, faction1, faction2, detail, this.PlayerDeclaredWarQuestLogText, this.QuestCanceledWarDeclared, false);
			}

			// Token: 0x06004FE8 RID: 20456 RVA: 0x0016CC0D File Offset: 0x0016AE0D
			protected override void OnFinalize()
			{
				if (this._lesserNobleParty.IsActive)
				{
					DestroyPartyAction.Apply(null, this._lesserNobleParty);
				}
			}

			// Token: 0x06004FE9 RID: 20457 RVA: 0x0016CC28 File Offset: 0x0016AE28
			protected override void InitializeQuestOnGameLoad()
			{
				this._tier5Troop = CharacterHelper.GetTroopTree(base.QuestGiver.Culture.EliteBasicTroop, 5f, 5f).First<CharacterObject>();
				this._tier6Troop = CharacterHelper.GetTroopTree(base.QuestGiver.Culture.EliteBasicTroop, 6f, 6f).First<CharacterObject>();
				this.SetDialogs();
			}

			// Token: 0x04001A51 RID: 6737
			private const int NeededVillageVisitCount = 20;

			// Token: 0x04001A52 RID: 6738
			private const int GoOutFromSettlementAfterHours = 5;

			// Token: 0x04001A53 RID: 6739
			private const int MinTroopToRecruit = 3;

			// Token: 0x04001A54 RID: 6740
			private const int MaxTroopToRecruit = 4;

			// Token: 0x04001A55 RID: 6741
			private const int NoblePartyMemberMaxLimitAtStart = 40;

			// Token: 0x04001A56 RID: 6742
			private const int LesserNoblePartySizeLimit = 80;

			// Token: 0x04001A57 RID: 6743
			[SaveableField(10)]
			private bool _checkForEventEnd;

			// Token: 0x04001A58 RID: 6744
			[SaveableField(20)]
			private TextObject _lesserNobleName;

			// Token: 0x04001A59 RID: 6745
			[SaveableField(30)]
			private MobileParty _lesserNobleParty;

			// Token: 0x04001A5A RID: 6746
			[SaveableField(50)]
			private List<Settlement> _suitableVillagesToVisitList;

			// Token: 0x04001A5B RID: 6747
			[SaveableField(60)]
			private List<Settlement> _visitedVillagesList;

			// Token: 0x04001A5C RID: 6748
			[SaveableField(70)]
			private bool _persuasionTriedOnce;

			// Token: 0x04001A5D RID: 6749
			[SaveableField(80)]
			private bool _firstTalkIsDone;

			// Token: 0x04001A5E RID: 6750
			[SaveableField(90)]
			private int _goOutFromSettlementAfterHoursCounter;

			// Token: 0x04001A5F RID: 6751
			[SaveableField(120)]
			private int _giveNotificationAfterHoursCounter;

			// Token: 0x04001A60 RID: 6752
			[SaveableField(100)]
			private JournalLog _discreteLog;

			// Token: 0x04001A61 RID: 6753
			[SaveableField(130)]
			private int _rewardGold;

			// Token: 0x04001A62 RID: 6754
			private CharacterObject _tier5Troop;

			// Token: 0x04001A63 RID: 6755
			private CharacterObject _tier6Troop;

			// Token: 0x04001A64 RID: 6756
			private PersuasionTask _task;

			// Token: 0x04001A65 RID: 6757
			private const PersuasionDifficulty Difficulty = PersuasionDifficulty.MediumHard;
		}

		// Token: 0x02000649 RID: 1609
		public class LesserNobleRevoltIssueBehaviorTypeDefiner : SaveableTypeDefiner
		{
			// Token: 0x06004FF0 RID: 20464 RVA: 0x0016CD0E File Offset: 0x0016AF0E
			public LesserNobleRevoltIssueBehaviorTypeDefiner() : base(870000)
			{
			}

			// Token: 0x06004FF1 RID: 20465 RVA: 0x0016CD1B File Offset: 0x0016AF1B
			protected override void DefineClassTypes()
			{
				base.AddClassDefinition(typeof(LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssue), 1, null);
				base.AddClassDefinition(typeof(LesserNobleRevoltIssueBehavior.LesserNobleRevoltIssueQuest), 2, null);
			}
		}
	}
}
